package com.atlyc.common.dto;

/**
 * 
 * 返回值code枚举
 * 
 * @author lyc
 *
 */
public enum ReturnResultCode {

    /**
     * 成功
     */
    SUCCESS(1000),
    /**
     * 身份验证失败
     */
    FAIL_AUTHORITY(1001),
    /**
     * 通用失败、运行时异常
     */
    FAIL_EXCEPTION(1002),
    /**
     * 字段验证失败
     */
    FAIL_FIELD(1003);

    ReturnResultCode(int code) {
        this.code = code;
    }

    private int code;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public static ReturnResultCode valueOf(int code) {
        ReturnResultCode[] values = values();
        for (ReturnResultCode c : values) {
            if (c.getCode() == code) {
                return c;
            }
        }
        return null;
    }
}
